package com.linxianqin.springbootVue.domain.dto;

import java.util.Date;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.linxianqin.springbootVue.domain.entity.SysDept;
import com.linxianqin.springbootVue.manage.annotation.Excel;
import com.linxianqin.springbootVue.manage.annotation.Excels;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


@Data
@ApiModel(value="SysUserDTO对象", description="用户信息表")
public class SysUserDTO implements Serializable {

    private static final long serialVersionUID=1L;
      public SysUserDTO()
      {
      }
      public SysUserDTO(Long userId)
      {
        this.userId = userId;
      }
      @ApiModelProperty(value = "用户ID")
      @JsonSerialize(using= ToStringSerializer.class)
      private Long userId;

      @ApiModelProperty(value = "部门ID")
      @JsonSerialize(using= ToStringSerializer.class)
      private Long deptId;

      @ApiModelProperty(value = "用户账号")
      private String userName;

      @ApiModelProperty(value = "用户昵称")
      private String nickName;

      @ApiModelProperty(value = "用户类型（00系统用户）")
      private String userType;

      @ApiModelProperty(value = "用户邮箱")
      private String email;

      @ApiModelProperty(value = "手机号码")
      private String phonenumber;

      @ApiModelProperty(value = "用户性别（0男 1女 2未知）")
      private String sex;

      @ApiModelProperty(value = "头像地址")
      private String avatar;

      @ApiModelProperty(value = "密码")
      private String password;

      @ApiModelProperty(value = "帐号状态（0正常 1停用）")
      private String status;

      @ApiModelProperty(value = "最后登录IP")
      private String loginIp;

      @ApiModelProperty(value = "最后登录时间")
      private Date loginDate;

      @ApiModelProperty(value = "创建者")
      private String createBy;

      @ApiModelProperty(value = "创建时间")
      @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      private Date createTime;

      @ApiModelProperty(value = "更新者")
      private String updateBy;

      @ApiModelProperty(value = "更新时间")
      @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      private Date updateTime;

      @ApiModelProperty(value = "备注")
      private String remark;

      @ApiModelProperty(value = "删除标志（0代表存在 1代表删除）")
      private String deleted;

      @ApiModelProperty(value = "角色对象")
      private List<SysRoleDTO> roles;

      @ApiModelProperty(value = "角色组")
      private Long[] roleIds;

      @ApiModelProperty(value = "岗位组")
      private Long[] postIds;

      @ApiModelProperty(value = "部门对象")
      private SysDeptDTO dept;
      /**
       * 判断是否是超级管理员账户
       * @return
       */
      public boolean isAdmin() {
        return isAdmin(this.userId);
      }
      public static boolean isAdmin(Long userId)
      {
        return userId != null && 1L == userId;
      }

}
